package com.xiaohe66.web.integration.value;

import com.xiaohe66.web.integration.domain.IntValue;
import lombok.EqualsAndHashCode;

/**
 * @author He
 * @since 2024.03.21 15:17
 */
@EqualsAndHashCode(callSuper = true)
public class DayValue extends IntValue {

    private DayValue(int value) {
        super(value);

        if (value <= 0 || value > 31) {
            throw new IllegalArgumentException("day value error :" + value);
        }
    }

    @Override
    public String toString() {
        return "Day(" + getValue() + ")";
    }

    public static DayValue valueOf(int value) {
        return new DayValue(value);
    }
}
